<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.min.js"></script>
</head>
<body>
<div id="app">
    <!--使用click.capture，实现捕获触发事件 从外层到里层-->
    <div style="background-color: darkcyan;height: 100px;" @click.capture="divHandle">
        <input type="button" value="点击" @click.stop="btnHandle">
        <a href="https://www.baidu.com" @click.prevent.stop="baiduHandle">点击前往百度</a>
        <input type="button" value="自己触发" @click.self="btnHandle">
        <a href="https://www.baidu.com" @click.prevent.once="baiduHandle">只能阻止一个百度</a>
    </div>
</div>
</body>
<script>
    const vm = new Vue({
        el: '#app',
        data: {
            msg: '猥琐发育,别浪～～！',
            intervalId: null
        },
        methods: {
            btnHandle() {
                console.log('触发了btn的click事件')
            },
            divHandle() {
                console.log('触发了div的click事件')
            },
            baiduHandle() {
                console.log('触发了百度按钮的click事件')
            }
        }
    })
</script>
</html>